﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using AutoCorrelatorGUI.Model;
using AutoCorrelatorGUI.Properties;
using AutoCorrelatorGUI.Utility;
using AutoCorrelatorGUI.ViewModel.Messages;
using Common.Utility;
using Common.ViewModel;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using GalaSoft.MvvmLight.Messaging;
using OxyPlot;
using OxyPlot.Series;

namespace AutoCorrelatorGUI.ViewModel
{
   /// <summary>
   /// This class contains properties that a View can data bind to.
   /// <para>
   /// See http://www.galasoft.ch/mvvm
   /// </para>
   /// </summary>
   public class ComparisonDisplayViewModel : ViewModelBase
   {
      /// <summary>
      /// Initializes a new instance of the MvvmViewModel1 class.
      /// </summary>
      public ComparisonDisplayViewModel()
      {
         Messenger.Default.Register<FullRefreshMessage>(this, OnFullRefresh);


         //Request any existing data
         Messenger.Default.Send(new RequestDataMessage(OnFullRefresh));
      }

      private void OnFullRefresh(FullRefreshMessage message)
      {
         InternalWellData = message.DataView.SourceCollection as MultiSelectBindingList<WellVM>;
         InternalWellDataView = message.DataView;
      }

      private MultiSelectBindingList<WellVM> _InternalWellData = null;

      public MultiSelectBindingList<WellVM> InternalWellData
      {
         get { return _InternalWellData; }
         set
         {
            if (_InternalWellData == value)
            {
               return;
            }

            _InternalWellData = value;
            RaisePropertyChanged("InternalWellData");
         }
      }

      private ListCollectionView _InternalWellDataView = null;

      public ListCollectionView InternalWellDataView
      {
         get
         {
            return _InternalWellDataView;
         }

         set
         {
            if (_InternalWellDataView == value)
            {
               return;
            }

            _InternalWellDataView = value;
            RaisePropertyChanged("InternalWellDataView");
         }
      }
   }
}
